Skip to content

[FEATURE] Add a Auto Setup files for Windows ,Linux ,Mac os for Devloper to easily setup in one click #445 - #446

Open
HindzStark wants to merge 1 commit into
apsinghdev:mainfrom
HindzStark:feature/Auto-Setup
Open

[FEATURE] Add a Auto Setup files for Windows ,Linux ,Mac os for Devloper to easily setup in one click #445#446
HindzStark wants to merge 1 commit into
apsinghdev:mainfrom
HindzStark:feature/Auto-Setup

Conversation

@HindzStark

@HindzStark HindzStark commented Aug 5, 2026

Copy link
Copy Markdown

Summary

This PR adds interactive setup scripts for Windows, Linux, and macOS to simplify the local development setup process.
Closes #445

Changes

  • Added setup-windows.ps1
  • Added setup-linux.sh
  • Added setup-mac.sh
  • Added interactive prompts for required environment variables
  • Automated dependency installation (pnpm install)
  • Automated Prisma client generation (pnpm exec prisma generate)
  • Automated initial database migration/setup
  • Updated README.md with streamlined setup instructions for all supported operating systems

Benefits

  • Reduces manual setup steps
  • Provides a consistent onboarding experience across platforms
  • Minimizes configuration errors for new contributors
Screenshot 2026-08-05 191151 Screenshot 2026-08-05 191326 Screenshot 2026-08-05 191443

Summary by CodeRabbit

  • New Features

    • Added guided setup scripts for Windows, Linux, and macOS.
    • Setup now validates or creates environment configuration, installs dependencies, prepares the database client, and optionally runs migrations.
    • Added platform-specific setup commands with completion instructions and local URLs.
  • Documentation

    • Added cross-platform setup documentation with Quick Start instructions and environment validation details.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

@HindzStark is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Added Windows, Linux, and macOS setup scripts. The scripts validate environment files, install dependencies, generate Prisma Client, optionally run migrations, and print startup instructions. Added npm commands and setup documentation.

Changes

Cross-platform developer setup

Layer / File(s) Summary
Setup entry points and documentation
package.json, setup/README.md
Added platform-specific npm commands and documented environment setup, dependency installation, Prisma generation, and optional migrations.
Environment validation and file creation
setup/setup-linux.sh, setup/setup-mac.sh, setup/setup-windows.ps1
Added platform-specific environment paths, validation for required API variables, and optional creation of API and web environment files.
Dependency and database initialization
setup/setup-linux.sh, setup/setup-mac.sh, setup/setup-windows.ps1
Added pnpm install, Prisma Client generation, optional development migrations, and completion messages with local URLs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant SetupScript
  participant EnvironmentFiles
  participant pnpm
  participant Prisma
  Developer->>SetupScript: Run platform-specific setup command
  SetupScript->>EnvironmentFiles: Validate or create environment files
  SetupScript->>pnpm: Install workspace dependencies
  SetupScript->>Prisma: Generate Prisma Client
  SetupScript->>Prisma: Optionally run development migrations
  SetupScript-->>Developer: Print startup command and local URLs
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The scripts cover all three operating systems and automate setup, but they optionally create environment files and migrations instead of enforcing the linked issue requirements. Make the scripts prompt developers to enter or confirm required environment values without creating .env files, and complete the required initial database setup.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the addition of automatic setup files for Windows, Linux, and macOS.
Out of Scope Changes check ✅ Passed The package scripts, setup scripts, and setup documentation directly support the linked issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (redundant_comments, description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@setup/README.md`:
- Around line 44-48: Update the “Smart Re-run (Idempotency)” statement to
accurately describe the validation performed by the setup scripts: they only
verify that required environment variables are non-empty, not that values such
as DATABASE_URL are valid. Keep the existing skip-prompts behavior documented
without claiming format validation.

In `@setup/setup-linux.sh`:
- Around line 60-77: Require valid environment values before initialization: in
setup/setup-linux.sh lines 60-77, setup/setup-mac.sh lines 60-77, and
setup/setup-windows.ps1 lines 52-69, prompt for missing API values, revalidate
after any file creation or user response, and exit if required values remain
invalid. In setup/setup-linux.sh lines 87-109, setup/setup-mac.sh lines 87-109,
and setup/setup-windows.ps1 lines 80-102, validate NEXT_PUBLIC_API_URL and
NEXTAUTH_SECRET in existing environment files before reporting success or
continuing with dependency and Prisma initialization; preserve the existing
API_ENV_PATH/API_NEEDS_ATTENTION flow.

In `@setup/setup-windows.ps1`:
- Around line 111-116: Update setup-windows.ps1 so the pnpm-driven setup flow
stops immediately on native command failures: after each pnpm invocation in the
root dependency install/update path and the later Prisma generation/migration
steps, check $LASTEXITCODE and throw if it is nonzero. Keep the existing control
flow in the setup script, but ensure the symbols around the pnpm calls and the
success banner cannot proceed after a failed install, generate, or migrate.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 72bf52bd-b5f1-470e-93a8-1870425dd93a

📥 Commits

Reviewing files that changed from the base of the PR and between a0c8d78 and 4782aa0.

📒 Files selected for processing (5)
  • package.json
  • setup/README.md
  • setup/setup-linux.sh
  • setup/setup-mac.sh
  • setup/setup-windows.ps1

Comment thread setup/README.md
Comment on lines +44 to +48
1. **Environment Variables Check (`.env` & `.env.local`)**:
- Verifies that `apps/api/.env` and `apps/web/.env.local` are present.
- Checks that essential variables (e.g., `DATABASE_URL`, `JWT_SECRET`, `PORT`, `NEXT_PUBLIC_API_URL`) are populated.
- If missing, guides you on what values are required to run locally.
- **Smart Re-run (Idempotency):** If `.env` files are already configured, it skips prompts on subsequent runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Align the rerun claim with the actual validation.

setup/setup-linux.sh:28-39 accepts any non-empty value for a required key. A value such as DATABASE_URL=placeholder can therefore pass the check and skip the prompts described here.

Either validate value formats before declaring the files configured, or change line 48 to state that the scripts check for non-empty values only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@setup/README.md` around lines 44 - 48, Update the “Smart Re-run
(Idempotency)” statement to accurately describe the validation performed by the
setup scripts: they only verify that required environment variables are
non-empty, not that values such as DATABASE_URL are valid. Keep the existing
skip-prompts behavior documented without claiming format validation.

Comment thread setup/setup-linux.sh
Comment on lines +60 to +77
if [ "$API_NEEDS_ATTENTION" = true ]; then
echo ""
echo -e "${CYAN}📌 Important environment variables for apps/api/.env:${NC}"
echo -e "${GRAY} - DATABASE_URL (e.g., postgresql://postgres:postgres@localhost:5432/opensox?schema=public)${NC}"
echo -e "${GRAY} - JWT_SECRET (e.g., a-random-secret-key)${NC}"
echo -e "${GRAY} - PORT (default: 8080)${NC}"
echo ""

if [ ! -f "$API_ENV_PATH" ]; then
read -p "Would you like to copy apps/api/.env.example to apps/api/.env now? (Y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
cp "$API_ENV_EXAMPLE" "$API_ENV_PATH"
echo -e "${GREEN}✅ Created apps/api/.env from .env.example. Please review and update DATABASE_URL if needed.${NC}"
else
echo -e "${YELLOW}Please create apps/api/.env manually with essential keys before running the app.${NC}"
fi
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Require valid environment values before initialization.

The scripts only show warnings when required values are absent. A user can decline file creation, or keep incomplete files, and setup still runs dependency and Prisma commands. This does not meet the required prompt-and-confirm setup flow.

  • setup/setup-linux.sh#L60-L77: Prompt for missing API values, revalidate them, and exit before initialization when they remain invalid.
  • setup/setup-linux.sh#L87-L109: Validate NEXT_PUBLIC_API_URL and NEXTAUTH_SECRET in existing files before reporting success or continuing.
  • setup/setup-mac.sh#L60-L77: Prompt for missing API values, revalidate them, and exit before initialization when they remain invalid.
  • setup/setup-mac.sh#L87-L109: Validate NEXT_PUBLIC_API_URL and NEXTAUTH_SECRET in existing files before reporting success or continuing.
  • setup/setup-windows.ps1#L52-L69: Prompt for missing API values, revalidate them, and exit before initialization when they remain invalid.
  • setup/setup-windows.ps1#L80-L102: Validate NEXT_PUBLIC_API_URL and NEXTAUTH_SECRET in existing files before reporting success or continuing.
📍 Affects 3 files
  • setup/setup-linux.sh#L60-L77 (this comment)
  • setup/setup-linux.sh#L87-L109
  • setup/setup-mac.sh#L60-L77
  • setup/setup-mac.sh#L87-L109
  • setup/setup-windows.ps1#L52-L69
  • setup/setup-windows.ps1#L80-L102
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@setup/setup-linux.sh` around lines 60 - 77, Require valid environment values
before initialization: in setup/setup-linux.sh lines 60-77, setup/setup-mac.sh
lines 60-77, and setup/setup-windows.ps1 lines 52-69, prompt for missing API
values, revalidate after any file creation or user response, and exit if
required values remain invalid. In setup/setup-linux.sh lines 87-109,
setup/setup-mac.sh lines 87-109, and setup/setup-windows.ps1 lines 80-102,
validate NEXT_PUBLIC_API_URL and NEXTAUTH_SECRET in existing environment files
before reporting success or continuing with dependency and Prisma
initialization; preserve the existing API_ENV_PATH/API_NEEDS_ATTENTION flow.

Comment thread setup/setup-windows.ps1
Comment on lines +111 to +116
if (-not (Test-Path (Join-Path $RootDir "node_modules"))) {
Write-Host "Installing dependencies with pnpm..." -ForegroundColor Cyan
pnpm install
} else {
Write-Host "[OK] Root node_modules found. Checking for updates..." -ForegroundColor Green
pnpm install --prefer-offline

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Stop the script when a pnpm command fails.

PowerShell does not throw by default when a native command returns a nonzero exit code. A failed pnpm install, Prisma generation, or migration can therefore continue to the success banner. Check $LASTEXITCODE after each pnpm call and throw when it is nonzero.

Proposed fix
+function Invoke-Pnpm {
+    param([Parameter(ValueFromRemainingArguments = $true)][string[]]$Arguments)
+
+    & pnpm `@Arguments`
+    if ($LASTEXITCODE -ne 0) {
+        throw "pnpm $($Arguments -join ' ') failed with exit code $LASTEXITCODE."
+    }
+}
+
-    pnpm install
+    Invoke-Pnpm install
...
-pnpm --filter api exec prisma generate
+Invoke-Pnpm --filter api exec prisma generate
...
-    pnpm --filter api exec prisma migrate dev
+    Invoke-Pnpm --filter api exec prisma migrate dev

Also applies to: 127-133

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@setup/setup-windows.ps1` around lines 111 - 116, Update setup-windows.ps1 so
the pnpm-driven setup flow stops immediately on native command failures: after
each pnpm invocation in the root dependency install/update path and the later
Prisma generation/migration steps, check $LASTEXITCODE and throw if it is
nonzero. Keep the existing control flow in the setup script, but ensure the
symbols around the pnpm calls and the success banner cannot proceed after a
failed install, generate, or migrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add a Auto Setup files for Windows ,Linux ,Mac os for Devloper to easily setup in one click

1 participant